<template>
<div class='bigcon'>
 <h4 class='infoh4'>{{newinfo.title}}</h4>
 <p class='infop'>
      <span>发表时间:{{newinfo.add_time|dateFormat}}</span>
      <span>点击{{newinfo.click}}次</span>
</p>
<hr>
<div class="cont" v-html='newinfo.content'></div>
<!--评论区域 路由传过来的参参数在template中直接使用$route.params.id就可以获取不用加this-->
<comment :id='$route.params.id'></comment>
</div>
</template>


<script>
import {toast} from 'mint-ui'
import comment from '../subcomponent/comment.vue'
export default{
    data(){
        return{
            newinfo:{}
        }
    },
    created(){
        this.getinfo()
    },
    methods:{
        getinfo(){
            this.$http.get('api/getnew/'+this.$route.params.id).then(result=>{
                // console.log(result)
               if(result.body.status==0){
                    this.newinfo=result.body.message[0]
               }else{
                   toast('失败')
               }
            })
        }
    },
    components:{//定义自己的私有组件
        comment,
    }
}

</script>

<style lang="scss" >
.bigcon{
    padding:0 5px;
    .infoh4{
        font-size:16px;
        color:red;
        margin:10px 0;
        
    }
    .infop{
        display:flex;
        justify-content:space-between;
        color:hotpink;
    }
    .cont{
        img{
            width:100%;
        }
    }
}
</style>
